3.11.43 \(\int (a+i a \tan (e+f x))^4 (c-i c \tan (e+f x))^n \, dx\) [1043]

Optimal. Leaf size=134 \[ \frac {8 i a^4 (c-i c \tan (e+f x))^n}{f n}-\frac {12 i a^4 (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}+\frac {6 i a^4 (c-i c \tan (e+f x))^{2+n}}{c^2 f (2+n)}-\frac {i a^4 (c-i c \tan (e+f x))^{3+n}}{c^3 f (3+n)} \]

[Out]

8*I*a^4*(c-I*c*tan(f*x+e))^n/f/n-12*I*a^4*(c-I*c*tan(f*x+e))^(1+n)/c/f/(1+n)+6*I*a^4*(c-I*c*tan(f*x+e))^(2+n)/
c^2/f/(2+n)-I*a^4*(c-I*c*tan(f*x+e))^(3+n)/c^3/f/(3+n)

________________________________________________________________________________________

Rubi [A]
time = 0.12, antiderivative size = 134, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3603, 3568, 45} \begin {gather*} -\frac {i a^4 (c-i c \tan (e+f x))^{n+3}}{c^3 f (n+3)}+\frac {6 i a^4 (c-i c \tan (e+f x))^{n+2}}{c^2 f (n+2)}+\frac {8 i a^4 (c-i c \tan (e+f x))^n}{f n}-\frac {12 i a^4 (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^4*(c - I*c*Tan[e + f*x])^n,x]

[Out]

((8*I)*a^4*(c - I*c*Tan[e + f*x])^n)/(f*n) - ((12*I)*a^4*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n)) + ((6*I
)*a^4*(c - I*c*Tan[e + f*x])^(2 + n))/(c^2*f*(2 + n)) - (I*a^4*(c - I*c*Tan[e + f*x])^(3 + n))/(c^3*f*(3 + n))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 3603

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x))^4 (c-i c \tan (e+f x))^n \, dx &=\left (a^4 c^4\right ) \int \sec ^8(e+f x) (c-i c \tan (e+f x))^{-4+n} \, dx\\ &=\frac {\left (i a^4\right ) \text {Subst}\left (\int (c-x)^3 (c+x)^{-1+n} \, dx,x,-i c \tan (e+f x)\right )}{c^3 f}\\ &=\frac {\left (i a^4\right ) \text {Subst}\left (\int \left (8 c^3 (c+x)^{-1+n}-12 c^2 (c+x)^n+6 c (c+x)^{1+n}-(c+x)^{2+n}\right ) \, dx,x,-i c \tan (e+f x)\right )}{c^3 f}\\ &=\frac {8 i a^4 (c-i c \tan (e+f x))^n}{f n}-\frac {12 i a^4 (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}+\frac {6 i a^4 (c-i c \tan (e+f x))^{2+n}}{c^2 f (2+n)}-\frac {i a^4 (c-i c \tan (e+f x))^{3+n}}{c^3 f (3+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 4.44, size = 180, normalized size = 1.34 \begin {gather*} \frac {i a^4 e^{n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x)))} \sec ^2(e+f x) (c \sec (e+f x))^n (\cos (4 f x)+i \sin (4 f x)) \left (3 \left (12+7 n+n^2\right )+\left (12+11 n+6 n^2+n^3\right ) (-1+2 \cos (2 (e+f x)))+i n \left (20+9 n+n^2+2 \left (11+6 n+n^2\right ) \cos (2 (e+f x))\right ) \tan (e+f x)\right )}{f n (1+n) (2+n) (3+n) (\cos (f x)+i \sin (f x))^4} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^4*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(I*a^4*E^(n*(-Log[c*Sec[e + f*x]] + Log[c - I*c*Tan[e + f*x]]))*Sec[e + f*x]^2*(c*Sec[e + f*x])^n*(Cos[4*f*x]
+ I*Sin[4*f*x])*(3*(12 + 7*n + n^2) + (12 + 11*n + 6*n^2 + n^3)*(-1 + 2*Cos[2*(e + f*x)]) + I*n*(20 + 9*n + n^
2 + 2*(11 + 6*n + n^2)*Cos[2*(e + f*x)])*Tan[e + f*x]))/(f*n*(1 + n)*(2 + n)*(3 + n)*(Cos[f*x] + I*Sin[f*x])^4
)

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 9 vs. order 3.
time = 1.08, size = 1784, normalized size = 13.31

method result size
risch \(\text {Expression too large to display}\) \(1784\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x,method=_RETURNVERBOSE)

[Out]

8*I*a^4/(1+n)/f/(exp(2*I*(f*x+e))+1)^3/(3+n)/n/(2+n)*(n^3*c^n*2^n/((exp(2*I*(f*x+e))+1)^n)*exp(-1/2*I*Pi*csgn(
I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*
c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*csgn(I*
c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+6*n^2*c^n*2^n/((exp(2*I*(f*x+e))+1)^n)*exp(-1/2*I*P
i*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*exp(1/2*I*Pi*
csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*
csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+11*n*c^n*2^n/((exp(2*I*(f*x+e))+1)^n)*exp(-1
/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*exp(1/2
*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e)
)+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+3*n^2*c^n*2^n/((exp(2*I*(f*x+e))+1)^n)
*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*n)*
exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*
(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(4*I*f*x)*exp(4*I*e)+6*c^n*2^n/((exp(2*I*(f*x+e))+1)
^n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I*c)*
n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2
*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(6*I*f*x)*exp(6*I*e)+15*n*c^n*2^n/((exp(2*I*(f*x+
e))+1)^n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn
(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(I*c/
(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(4*I*f*x)*exp(4*I*e)+18*c^n*2^n/((exp(2*I*(
f*x+e))+1)^n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*
csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*csgn(
I*c/(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(4*I*f*x)*exp(4*I*e)+6*n*c^n*2^n/((exp(
2*I*(f*x+e))+1)^n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1
))^2*csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I*Pi*
csgn(I*c/(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(2*I*f*x)*exp(2*I*e)+18*c^n*2^n/((
exp(2*I*(f*x+e))+1)^n)*exp(-1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^3*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e
))+1))^2*csgn(I*c)*n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))^2*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(-1/2*I
*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*csgn(I*c)*csgn(I/(exp(2*I*(f*x+e))+1))*n)*exp(2*I*f*x)*exp(2*I*e)+6*c^n*2^n
/((exp(2*I*(f*x+e))+1)^n)*exp(1/2*I*Pi*csgn(I*c/(exp(2*I*(f*x+e))+1))*n*(csgn(I*c/(exp(2*I*(f*x+e))+1))-csgn(I
/(exp(2*I*(f*x+e))+1)))*(-csgn(I*c/(exp(2*I*(f*x+e))+1))+csgn(I*c))))

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 905 vs. \(2 (122) = 244\).
time = 0.59, size = 905, normalized size = 6.75 \begin {gather*} \frac {3 \cdot 2^{n + 4} a^{4} c^{n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - 3 i \cdot 2^{n + 4} a^{4} c^{n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + 48 \, {\left (a^{4} c^{n} n + 3 \, a^{4} c^{n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + 24 \, {\left (a^{4} c^{n} n^{2} + 5 \, a^{4} c^{n} n + 6 \, a^{4} c^{n}\right )} 2^{n} \cos \left (-4 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 4 \, e\right ) + 8 \, {\left (a^{4} c^{n} n^{3} + 6 \, a^{4} c^{n} n^{2} + 11 \, a^{4} c^{n} n + 6 \, a^{4} c^{n}\right )} 2^{n} \cos \left (-6 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 6 \, e\right ) + 48 \, {\left (-i \, a^{4} c^{n} n - 3 i \, a^{4} c^{n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + 24 \, {\left (-i \, a^{4} c^{n} n^{2} - 5 i \, a^{4} c^{n} n - 6 i \, a^{4} c^{n}\right )} 2^{n} \sin \left (-4 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 4 \, e\right ) + 8 \, {\left (-i \, a^{4} c^{n} n^{3} - 6 i \, a^{4} c^{n} n^{2} - 11 i \, a^{4} c^{n} n - 6 i \, a^{4} c^{n}\right )} 2^{n} \sin \left (-6 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 6 \, e\right )}{{\left ({\left (-i \, n^{4} - 6 i \, n^{3} - 11 i \, n^{2} - 6 i \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (6 \, f x + 6 \, e\right ) - 3 \, {\left (i \, n^{4} + 6 i \, n^{3} + 11 i \, n^{2} + 6 i \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (4 \, f x + 4 \, e\right ) + {\left (n^{4} + 6 \, n^{3} + 11 \, n^{2} + 6 \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (6 \, f x + 6 \, e\right ) + 3 \, {\left (n^{4} + 6 \, n^{3} + 11 \, n^{2} + 6 \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (4 \, f x + 4 \, e\right ) + {\left (-i \, n^{4} - 6 i \, n^{3} - 11 i \, n^{2} - 3 \, {\left (i \, n^{4} + 6 i \, n^{3} + 11 i \, n^{2} + 6 i \, n\right )} \cos \left (2 \, f x + 2 \, e\right ) + 3 \, {\left (n^{4} + 6 \, n^{3} + 11 \, n^{2} + 6 \, n\right )} \sin \left (2 \, f x + 2 \, e\right ) - 6 i \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n}\right )} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")

[Out]

(3*2^(n + 4)*a^4*c^n*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - 3*I*2^(n + 4)*a^4*c^n*sin(n*arct
an2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + 48*(a^4*c^n*n + 3*a^4*c^n)*2^n*cos(-2*f*x + n*arctan2(sin(2*f*x
 + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) + 24*(a^4*c^n*n^2 + 5*a^4*c^n*n + 6*a^4*c^n)*2^n*cos(-4*f*x + n*arctan2(
sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 4*e) + 8*(a^4*c^n*n^3 + 6*a^4*c^n*n^2 + 11*a^4*c^n*n + 6*a^4*c^n)*2^
n*cos(-6*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 6*e) + 48*(-I*a^4*c^n*n - 3*I*a^4*c^n)*2^n*
sin(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) + 24*(-I*a^4*c^n*n^2 - 5*I*a^4*c^n*n - 6
*I*a^4*c^n)*2^n*sin(-4*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 4*e) + 8*(-I*a^4*c^n*n^3 - 6*
I*a^4*c^n*n^2 - 11*I*a^4*c^n*n - 6*I*a^4*c^n)*2^n*sin(-6*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) +
1) - 6*e))/(((-I*n^4 - 6*I*n^3 - 11*I*n^2 - 6*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*
e) + 1)^(1/2*n)*cos(6*f*x + 6*e) - 3*(I*n^4 + 6*I*n^3 + 11*I*n^2 + 6*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*
e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*cos(4*f*x + 4*e) + (n^4 + 6*n^3 + 11*n^2 + 6*n)*(cos(2*f*x + 2*e)^2 + s
in(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*sin(6*f*x + 6*e) + 3*(n^4 + 6*n^3 + 11*n^2 + 6*n)*(cos(2*f
*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n)*sin(4*f*x + 4*e) + (-I*n^4 - 6*I*n^3 - 11*I
*n^2 - 3*(I*n^4 + 6*I*n^3 + 11*I*n^2 + 6*I*n)*cos(2*f*x + 2*e) + 3*(n^4 + 6*n^3 + 11*n^2 + 6*n)*sin(2*f*x + 2*
e) - 6*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n))*f)

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 247 vs. \(2 (122) = 244\).
time = 1.10, size = 247, normalized size = 1.84 \begin {gather*} -\frac {8 \, {\left (-6 i \, a^{4} + {\left (-i \, a^{4} n^{3} - 6 i \, a^{4} n^{2} - 11 i \, a^{4} n - 6 i \, a^{4}\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (-i \, a^{4} n^{2} - 5 i \, a^{4} n - 6 i \, a^{4}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 6 \, {\left (-i \, a^{4} n - 3 i \, a^{4}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac {2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n + {\left (f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n\right )} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (f n^{4} + 6 \, f n^{3} + 11 \, f n^{2} + 6 \, f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")

[Out]

-8*(-6*I*a^4 + (-I*a^4*n^3 - 6*I*a^4*n^2 - 11*I*a^4*n - 6*I*a^4)*e^(6*I*f*x + 6*I*e) + 3*(-I*a^4*n^2 - 5*I*a^4
*n - 6*I*a^4)*e^(4*I*f*x + 4*I*e) + 6*(-I*a^4*n - 3*I*a^4)*e^(2*I*f*x + 2*I*e))*(2*c/(e^(2*I*f*x + 2*I*e) + 1)
)^n/(f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n + (f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n)*e^(6*I*f*x + 6*I*e) + 3*(f*n^4
+ 6*f*n^3 + 11*f*n^2 + 6*f*n)*e^(4*I*f*x + 4*I*e) + 3*(f*n^4 + 6*f*n^3 + 11*f*n^2 + 6*f*n)*e^(2*I*f*x + 2*I*e)
)

________________________________________________________________________________________

Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 2225 vs. \(2 (110) = 220\).
time = 1.74, size = 2225, normalized size = 16.60 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**4*(c-I*c*tan(f*x+e))**n,x)

[Out]

Piecewise((x*(I*a*tan(e) + a)**4*(-I*c*tan(e) + c)**n, Eq(f, 0)), (-6*a**4*f*x*tan(e + f*x)**3/(6*c**3*f*tan(e
 + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x) - 6*I*c**3*f) - 18*I*a**4*f*x*tan(e + f*x)**
2/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x) - 6*I*c**3*f) + 18*a**4*f*x
*tan(e + f*x)/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x) - 6*I*c**3*f) +
 6*I*a**4*f*x/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x) - 6*I*c**3*f) -
 3*I*a**4*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**3/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 1
8*c**3*f*tan(e + f*x) - 6*I*c**3*f) + 9*a**4*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2/(6*c**3*f*tan(e + f*x)**
3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x) - 6*I*c**3*f) + 9*I*a**4*log(tan(e + f*x)**2 + 1)*tan
(e + f*x)/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x) - 6*I*c**3*f) - 3*a
**4*log(tan(e + f*x)**2 + 1)/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*tan(e + f*x)
- 6*I*c**3*f) + 36*a**4*tan(e + f*x)**2/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3*f*ta
n(e + f*x) - 6*I*c**3*f) + 36*I*a**4*tan(e + f*x)/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18
*c**3*f*tan(e + f*x) - 6*I*c**3*f) - 16*a**4/(6*c**3*f*tan(e + f*x)**3 + 18*I*c**3*f*tan(e + f*x)**2 - 18*c**3
*f*tan(e + f*x) - 6*I*c**3*f), Eq(n, -3)), (6*a**4*f*x*tan(e + f*x)**2/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*ta
n(e + f*x) - c**2*f) + 12*I*a**4*f*x*tan(e + f*x)/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2*f)
- 6*a**4*f*x/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2*f) + 3*I*a**4*log(tan(e + f*x)**2 + 1)*t
an(e + f*x)**2/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2*f) - 6*a**4*log(tan(e + f*x)**2 + 1)*t
an(e + f*x)/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2*f) - 3*I*a**4*log(tan(e + f*x)**2 + 1)/(c
**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2*f) - a**4*tan(e + f*x)**3/(c**2*f*tan(e + f*x)**2 + 2*I
*c**2*f*tan(e + f*x) - c**2*f) - 15*a**4*tan(e + f*x)/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2
*f) - 10*I*a**4/(c**2*f*tan(e + f*x)**2 + 2*I*c**2*f*tan(e + f*x) - c**2*f), Eq(n, -2)), (-24*a**4*f*x*tan(e +
 f*x)/(2*c*f*tan(e + f*x) + 2*I*c*f) - 24*I*a**4*f*x/(2*c*f*tan(e + f*x) + 2*I*c*f) - 12*I*a**4*log(tan(e + f*
x)**2 + 1)*tan(e + f*x)/(2*c*f*tan(e + f*x) + 2*I*c*f) + 12*a**4*log(tan(e + f*x)**2 + 1)/(2*c*f*tan(e + f*x)
+ 2*I*c*f) + I*a**4*tan(e + f*x)**3/(2*c*f*tan(e + f*x) + 2*I*c*f) + 9*a**4*tan(e + f*x)**2/(2*c*f*tan(e + f*x
) + 2*I*c*f) + 26*a**4/(2*c*f*tan(e + f*x) + 2*I*c*f), Eq(n, -1)), (8*a**4*x + 4*I*a**4*log(tan(e + f*x)**2 +
1)/f + a**4*tan(e + f*x)**3/(3*f) - 2*I*a**4*tan(e + f*x)**2/f - 7*a**4*tan(e + f*x)/f, Eq(n, 0)), (a**4*n**3*
(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)**3/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) - 3*I*a**4*n**3*(-I*c*tan(e
 + f*x) + c)**n*tan(e + f*x)**2/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) - 3*a**4*n**3*(-I*c*tan(e + f*x) + c)*
*n*tan(e + f*x)/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) + I*a**4*n**3*(-I*c*tan(e + f*x) + c)**n/(f*n**4 + 6*f
*n**3 + 11*f*n**2 + 6*f*n) + 3*a**4*n**2*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)**3/(f*n**4 + 6*f*n**3 + 11*f*
n**2 + 6*f*n) - 15*I*a**4*n**2*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)**2/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f
*n) - 21*a**4*n**2*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) + 9*I*a**4*
n**2*(-I*c*tan(e + f*x) + c)**n/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) + 2*a**4*n*(-I*c*tan(e + f*x) + c)**n*
tan(e + f*x)**3/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) - 12*I*a**4*n*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)*
*2/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) - 42*a**4*n*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)/(f*n**4 + 6*f*n
**3 + 11*f*n**2 + 6*f*n) + 32*I*a**4*n*(-I*c*tan(e + f*x) + c)**n/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n) + 48
*I*a**4*(-I*c*tan(e + f*x) + c)**n/(f*n**4 + 6*f*n**3 + 11*f*n**2 + 6*f*n), True))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^4*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((I*a*tan(f*x + e) + a)^4*(-I*c*tan(f*x + e) + c)^n, x)

________________________________________________________________________________________

Mupad [B]
time = 9.23, size = 229, normalized size = 1.71 \begin {gather*} -\frac {{\mathrm {e}}^{-e\,3{}\mathrm {i}-f\,x\,3{}\mathrm {i}}\,{\left (c-\frac {c\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^n\,\left (\frac {48\,a^4}{f\,n\,\left (n^3\,1{}\mathrm {i}+n^2\,6{}\mathrm {i}+n\,11{}\mathrm {i}+6{}\mathrm {i}\right )}+\frac {48\,a^4\,{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,\left (n+3\right )}{f\,n\,\left (n^3\,1{}\mathrm {i}+n^2\,6{}\mathrm {i}+n\,11{}\mathrm {i}+6{}\mathrm {i}\right )}+\frac {24\,a^4\,{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,\left (n^2+5\,n+6\right )}{f\,n\,\left (n^3\,1{}\mathrm {i}+n^2\,6{}\mathrm {i}+n\,11{}\mathrm {i}+6{}\mathrm {i}\right )}+\frac {8\,a^4\,{\mathrm {e}}^{e\,6{}\mathrm {i}+f\,x\,6{}\mathrm {i}}\,\left (n^3+6\,n^2+11\,n+6\right )}{f\,n\,\left (n^3\,1{}\mathrm {i}+n^2\,6{}\mathrm {i}+n\,11{}\mathrm {i}+6{}\mathrm {i}\right )}\right )}{8\,{\cos \left (e+f\,x\right )}^3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(e + f*x)*1i)^4*(c - c*tan(e + f*x)*1i)^n,x)

[Out]

-(exp(- e*3i - f*x*3i)*(c - (c*sin(e + f*x)*1i)/cos(e + f*x))^n*((48*a^4)/(f*n*(n*11i + n^2*6i + n^3*1i + 6i))
 + (48*a^4*exp(e*2i + f*x*2i)*(n + 3))/(f*n*(n*11i + n^2*6i + n^3*1i + 6i)) + (24*a^4*exp(e*4i + f*x*4i)*(5*n
+ n^2 + 6))/(f*n*(n*11i + n^2*6i + n^3*1i + 6i)) + (8*a^4*exp(e*6i + f*x*6i)*(11*n + 6*n^2 + n^3 + 6))/(f*n*(n
*11i + n^2*6i + n^3*1i + 6i))))/(8*cos(e + f*x)^3)

________________________________________________________________________________________